package com.leanyuan.check.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.leanyuan.check.domain.Conditiontask;
import com.leanyuan.check.domain.StaffMsg;
import com.leanyuan.check.service.ConditiontaskService_C;
import com.leanyuan.check.service.StaffMsgService_C;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 相亲相爱一家人
 * @since 2021-05-25
 */
@CrossOrigin
@RestController
@RequestMapping("/leanyuan/Staffmsg")
public class StaffMsgControllerOne {

    @Autowired
    StaffMsgService_C staffMsgServiceC;
    @Autowired
    ConditiontaskService_C conditiontaskServiceC;

    @RequestMapping("FindAllStaffmsg")
    public List<StaffMsg> FindAll(Model model){
        List<StaffMsg> list= staffMsgServiceC.list(null);
        model.addAttribute("staffmsglist",list);
        return list;
    }

    @RequestMapping("FindAllStaffmsg1")
    public List<StaffMsg> FindAll1(Model model){
        System.out.println(1);
        List<Conditiontask> tasklist= conditiontaskServiceC.list(null);
        QueryWrapper wrapper=new QueryWrapper();
        for (Conditiontask c:tasklist) {
            wrapper.notIn("staff_id", c.getConditiontaskId());
        }
        List<StaffMsg> list= staffMsgServiceC.list(wrapper);
        model.addAttribute("staffmsglist",list);
        return list;
    }
}

